#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	for (int a = 1; a <= 5; a++)
	{
		for (int b = 1; b <= 5; b++)
		{
			for (int c = 1; c <= 5; c++)
			{
				for (int d = 1; d <= 5; d++)
				{
					for (int e = 1; e <= 5; e++)
					{
						if (1 == ((2 == b) + (3 == a)) &&
							1 == ((2 == b) + (4 == e)) &&
							1 == ((1 == c) + (2 == d)) &&
							1 == ((5 == c) + (3 == d)) &&
							1 == ((4 == e) + (1 == a)))
						{
							if (120 == a * b * c * d * e)
							{
								printf("a:%d b:%d c:%d d:%d e:%d\n", a, b, c, d, e);
								goto end;
							}
						}
					}
				}
			}
		}
	}
end:
	return 0;
}